import { getAscendingId as getAscendingId_  } from './utils/micro.util';
import { getNgRoute as getNgRoute_, setMAINROUTE as setMAINROUTE_  } from './utils/route/route';
import * as interfaceModel_ from './interface/micro.interface';
import { globalStore as globalStore_  } from './utils/global-store';
import { BehaviorSubject as BehaviorSubject_ } from 'rxjs';




let getNgRoute, setMAINROUTE, interfaceModel,  getAscendingId, globalStore, BehaviorSubject;

if ((window as any).DSMICRO) {
  getNgRoute =  (window as any).DSMICRO.getNgRoute;
  setMAINROUTE =  (window as any).DSMICRO.setMAINROUTE;
  interfaceModel =  (window as any).DSMICRO.interfaceModel;
  getAscendingId =  (window as any).DSMICRO.getAscendingId;
  globalStore =  (window as any).DSMICRO.globalStore;
  BehaviorSubject =  (window as any).DSMICRO.BehaviorSubject;
  BehaviorSubject =  (window as any).DSMICRO.BehaviorSubject;
  console.warn('微前端共享依赖已初始化');
} else {
  getNgRoute = getNgRoute_;
  setMAINROUTE = setMAINROUTE_;
  interfaceModel =  interfaceModel_;
  getAscendingId = getAscendingId_;
  globalStore = globalStore_;
  BehaviorSubject = BehaviorSubject_;
  (window as any).DSMICRO = {
    getNgRoute,
    setMAINROUTE,
    interfaceModel,
    getAscendingId,
    globalStore,
    BehaviorSubject
  };
  console.log('调用微前端共享依赖初始化', (window as any).DSMICRO);
}

console.log('共享依赖被执行', getAscendingId());



export {getNgRoute, setMAINROUTE, interfaceModel,  getAscendingId,globalStore, BehaviorSubject };
